﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Campaign>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Create Campaign
</asp:Content>

<asp:Content ID="javascript" ContentPlaceHolderID="Javascript" runat="server">
    
    <script type="text/javascript">
        $(document).ready(function() {

        $("#CampaignDate").dateinput({ format: 'dd/mm/yyyy' });
        $("#LastContactDate").dateinput({ format: 'dd/mm/yyyy' });
            $("#CategoryId").change(function() {
                //alert("change");
                var catDrillDownsUrl = '<%= Url.Action("CategoryDrillDowns", "Enquiry", new {typeID = 1, id = 999}) %>';
                var url = catDrillDownsUrl.replace("999", $(this).val());
                //alert(url);
                $("#product").show();
                $("#product").load(url, productDrillDownLoaded);
            });
        });

        var productDrillDownLoaded = function() {

        if ($("#DrillDown1").length == 1) {
            $("#type").show();
            $("#typeId").focus();
        }
        }   

        
    </script>
</asp:Content>

<asp:Content ID="ContentHeader" ContentPlaceHolderID="ContentHeader" runat="server">
Create a Campaign
</asp:Content>  

<asp:Content ID="ContentSubNav" ContentPlaceHolderID="ContentSubNav" runat="server">
    
    <li class="selected"><%= Html.ActionLink("Index", "Index", "Campaign")%></li>
    <li class=""><%= Html.ActionLink("Create", "Create", "Campaign")%></li>
    <%--<li class=""><%= Html.ActionLink("Create", "Create", "Enquiry")%></li>--%>
    
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <%--<% Html.EnableClientValidation(); %>--%>

    <%= Html.ValidationSummary(true, "There were some errors with your form. Please correct and try again") %>
    
    <% using (Html.BeginForm("Create", "Campaign", FormMethod.Post, new {id = "EnquiryForm",  @class = "faux_form" })){%> 
    
            <%--USER INFO--%>
            <div class="formRegion"> 
                <div>
                    <%= Html.LabelFor(m => m.CampaignName)%>
                    <%= Html.TextBoxFor(m => m.CampaignName, new {@class = "text"}) %>
                    <%= Html.ValidationMessageFor(m => m.CampaignName) %>
                </div>
                
                <div>
                    <%= Html.LabelFor(m => m.CampaignType)%>
                    <%= Html.DropDownListFor(m => m.CampaignType,
                            SelectListHelpers.GetSelectListFromEnum<Campaign.CampaignTypes>(), 
                            "Set the Type", 
                            new { @class = "text required" }  
                     ) %>
                    <%= Html.ValidationMessageFor(m => m.CampaignType)%>
                </div>
                
                <div>
                    <%= Html.LabelFor(m => m.CampaignDate)%>
                    <%= Html.TextBoxFor(m => m.CampaignDate, new { @class = "text" })%>
                    <%= Html.ValidationMessageFor(m => m.CampaignDate)%>
                </div>
             
                <%--CATEGORY--%>
                <div id="drilldowns" class="formRegion">
	                <%--<% Html.RenderAction("DrillDown", new { }); %>--%>
	                <% Html.RenderPartial("Partial/DrillDown", new SpotlessWeb.Models.CampaignDrillDownViewModel() { AllowEdit = true, Campaign = new Campaign(), Categories = ViewData.GetCategories().ToArray(), DrillDowns = new DrillDown[0] }); %>
                </div>
                
                <div>
                    <%= Html.LabelFor(m => m.LastContactDate)%>
                    <%= Html.TextBoxFor(m => m.LastContactDate, new { @class = "text" })%>
                    <%= Html.ValidationMessageFor(m => m.LastContactDate)%>
                </div>
                
            <div>
            <input type="submit" class="submit" value="ENTER" />
            </div>
            <% } %>

</asp:Content>